swiftui pintch to zoom

235

struct ContentView: View {
    @State var scale: CGFloat = 1.0
    var body: some View {
       Image("apple-logo")
        .resizable()
        .scaleEffect(scale)
        .frame(width: 100, height: 100)
        .gesture(MagnificationGesture()
            .onChanged { value in
                self.scale = value.magnitude
            }
        )
    }
}

Comments

Submit
0 Comments